package com.qqtech.qquan.order.dao;

import java.math.BigDecimal;
import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;

import com.qqtech.core.frame.dao.BaseDao;
import com.qqtech.qquan.order.model.OrderBase;
import com.qqtech.qquan.order.model.OrderBaseQuery;
import com.qqtech.qquan.order.model.OrderBaseVo;

public interface OrderBaseDao extends BaseDao<OrderBase> {
	/**
	 * 获取SellerTotal金额总额
	 * @param query
	 * @return
	 */
	public BigDecimal getSumSellerTotal(OrderBaseQuery query);

	public OrderBaseVo getByOrderNo(java.lang.String orderNo);

	/**
	 * 后台查询
	 * 
	 * @param query
	 * @param pageable
	 * @return
	 */
	public Page<OrderBaseVo> queryPageListAdmin(OrderBaseQuery query, Pageable pageable);

	/**
	 * 后台查询-数量
	 * 
	 * @param query
	 * @return
	 */
	int queryCountAdmin(OrderBaseQuery query);

	/**
	 * 后台导出excel
	 * 
	 * @param query
	 * @param pageable
	 * @return
	 */
	public List<OrderBaseVo> queryList4Excel(OrderBaseQuery query, Pageable pageable);

	/**
	 * 根据根据供应商(商城)或店铺(圈商)查询订单列表
	 * 
	 * @param query
	 * @param pageable
	 * @return
	 */
	public Page<OrderBaseVo> queryPageBySupplier(OrderBaseQuery query, Pageable pageable);

	/**
	 * 根据根据供应商(商城)或店铺(圈商)查询订单数量
	 * 
	 * @param query
	 * @return
	 */
	public int queryCountBySupplier(OrderBaseQuery query);

	/**
	 * 配送人员查询订单列表
	 * 
	 * @param query
	 * @param pageable
	 * @return
	 */
	public Page<OrderBaseVo> queryPageBySendDeliveryUser(OrderBaseQuery query, Pageable pageable);

	/**
	 * 配送人员查询订单数量
	 * 
	 * @param query
	 * @return
	 */
	public int queryCountBySendDeliveryUser(OrderBaseQuery query);

	/**
	 * 更新订单状态为已取消
	 * 
	 * @param query
	 * @return
	 */
	int updateOrderStatusToCancle(OrderBaseQuery query);

	/**
	 * 更新订单状态为已发货
	 * 
	 * @param query
	 * @return
	 */
	int updateOrderStatusToSended(OrderBaseQuery query);

	/**
	 * 更新订单状态为已签收
	 * 
	 * @param query
	 * @return
	 */
	int updateOrderStatusToSigned(OrderBaseQuery query);

	/**
	 * 更新订单状态为已付款
	 * 
	 * @param query
	 * @return
	 */
	int updateOrderStatusToPayed(OrderBaseQuery query);

	/**
	 * 更新订单退货状态
	 * 
	 * @param query
	 * @return
	 */
	int updateOrderReturnStatus(OrderBaseQuery query);

	/**
	 * 查询订单总金额
	 * 
	 * @param query
	 * @return
	 */
	BigDecimal queryTotalPriceByShop(OrderBaseQuery query);

	/**
	 * 更新订单的退款状态
	 * 
	 * @return
	 */
	int updateReturnPayStatus(OrderBaseQuery newOrderBaseOther);

	/**
	 * 更新卖家总额
	 * 
	 * @param query
	 * @return
	 */
	int updateSellerTotalById(OrderBaseQuery query);

	/**
	 * admin管理后台查询订单汇总金额
	 * @param query
	 * @return
	 */
	BigDecimal getSumTotal4Admin(OrderBaseQuery query);

	List<OrderBaseVo> queryOrderCountByUserIds(OrderBaseQuery query);
}
